namespace java com.vng.zing.survey.thrift.model
namespace cpp  com.vng.zing.survey.thrift.model


typedef i32 IDUser
typedef i32 IDSurvey
typedef i16 IDQues
enum State{
	VIEW = 0,
	RESPONSE = 1,
	NEW = 2,
	ERR_ID=3
}
enum Error{
	IDUSER_ERR=0,
	MAX_COUNT_SURVEY=1,
	ERR_SYSTEM=2,
	SUCCESS =3,
	IDSURVEY_NO_EXITS=4,
	RESPONSE_NO_EXITS =5


}
enum QuesType{
	SINGLE_SELECTION =0,
	MULTI_CHOICE=1,
	SINGLE_LINE=2,
	MULTI_LINE =3			


}
enum UserType{
   USER =0,
   ADMIN =1

}

// store list IDSurvey of IDUser
typedef IDUser IDSurveyKey
struct IDSurveyItem{
	1: list<IDSurvey> idSurveys,
	2: i32 count
}

struct Question{
	1: IDQues idQues,
	2: string titleQues,
	3: string helpText,
	4: bool require,
        5: QuesType type,
	6: list<string> choices
}
typedef IDSurvey SurveyKey
struct SurveyItem{
	1: IDUser iDUser,
	2: string title,
	3: string description,
	4: list<Question> questions,
	5: i32 createdDay,
      	6: i32 beginDay,
	7: i32 endDay,
	8: i16 point,
	9: bool status,
	10: bool option
}
struct SurveyItemResult{
	1: Error erro,
	2: SurveyItem surveyItem
}
struct IDSurveyResult{
	1: IDSurvey idSurvey,
	2: Error error
}
struct ShortInfoSurveyItem{
	1: IDSurvey idSurvey,
	2: bool status,
	3: i32 view,
	4: i32 response,
	5: string title,
	6: string description
}

struct AnswerKey{
	1: IDSurvey idSurvey,
	2: IDUser idUser,
	3: IDQues idQues
}
struct AnswerItem{
	1: QuesType type,
	2: IDQues idQues,
	3: string answer,
	4: bool require,
	5: i32 timeResponse,
	6: string displayName	
}
struct Response{
       1: list<AnswerItem> answers;
       2: IDUser idUser,
       3: string displayName
    
}
struct ResponseKey{
	1: IDSurvey idSurvey,
	2: IDUser idUser
}

typedef IDSurvey IDUserResponseKey
struct IDUserResponseItem{
      1: list<IDUser> idUsers
}
struct IDUserResQuesNoRequiKey{
	1: IDSurvey idSurvey,
	2: IDQues idQues

}
struct QuestionStats{
	1: QuesType type,
	2: list<i32> number

}
typedef IDSurvey SurveyStatsKey
struct SurveyStatsItem{
	1: i32 IDUser,
	2: i32 view,
	3: i32 response,
	4: map<IDQues,QuestionStats> stats,
}
struct SurveyStatsResult{
	1: Error erro,
	2: SurveyStatsItem surveyStatsItem
}
struct ViewKey{
	1: IDSurvey idSurvey,
	2: IDUser idUser
}
struct SurveyStatsPerDayKey{
	1: IDSurvey idSurvey,
	2: i32 day

}
struct SurveyStatsPerDayItem{
        1: i32 view,
	2: i32 response,
	3: i32 addView,
	4: i32 addResponse,
	5: i32 day

}

